package com.example.project.manageController;

import com.example.project.dao.ParkingTypeDAO;
import com.example.project.pojo.ParkingType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("manage")
public class ManageViewParking_typeController {
    @RequestMapping("viewParking_type")
    public String viewParking_type(Model model){
        List<ParkingType> List=new ArrayList<>();
        ParkingTypeDAO parkingTypeDAO=new ParkingTypeDAO();
        List=parkingTypeDAO.findAll();
        model.addAttribute("List",List);
        return "manage/viewparking_type";
    }
    @RequestMapping("delParking")
    public String delParking(int id){
        ParkingTypeDAO parkingTypeDAO=new ParkingTypeDAO();
        parkingTypeDAO.delPark(id);
        return "redirect:/manage/viewParking_type";
    }
}
